<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
    <meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
        name="viewport">
    <title>搜索结果</title>
    <meta name="keywords" content="搜索结果" />
    <meta name="description" content="搜索结果" />
    <link rel="stylesheet" href="/static/css/style.css" media="all">
    <script type="text/javascript" src="/static/js/jquery.min.js"></script>
    <script type="text/javascript" src="/static/js/ad.js"></script>
</head>

<body>
    <script>
        site();
    </script>
     {% include "/index/common/header.html" %}<div id="tad">
        <script>
            tjs();
        </script>
    </div>

    <div class="box mt10">
        <div class="fl_640">
                {% for row in list %}
                    <div class="list">
                        {% if row.litpic %}
                            <a class="limg" href="{{row.id|getArticleDetailUrl}}"><img
                                alt="{{row.title}}" src="/static{{row.litpic}}"></a>{% endif %}
                        <strong class="tit"><a
                                href="{{row.id|getArticleDetailUrl}}">{{row.title}}</a></strong>
                        <p>{{row.description}}..</p>
                        <div class="info"><span
                                class="fl"><em>{{row.update_time|date}}</em></span><span
                                class="fr"><em>{{row.click}}</em>人阅读</span></div>
                        <div class="cl"></div>
                    </div>{% endfor %} {% if list|length == 0 %}<div style="text-align:center;padding:20px;">暂无记录</div>{% endif %}<div id="lad2">
                <script>
                    ljs2();
                </script>
            </div>

            <ul class="pagination" style="margin: 0 20px 0 20px;">
                </ul>
        </div><!-- fl_640 end -->

        <div class="fr_300">
            <div id="rad1">
                <script>
                    rjs1();
                </script>
            </div>
            <div class="side">
        
                <div class="stit">
                    <h2>推荐阅读</h2><a
                        href="javascript:getmore({limit:5,tuijian:1,mode:1,orderby:'rand'});"
                        class="more">换一换</a>
                    <div class="cl"></div>
                </div>
                <ul class="uli chs" id="xglist">{% for row in relate_tuijian_list %}
                    <li><a
                            href="{{row.id|getArticleDetailUrl}}">{{row.title}}</a>
                    </li>{% endfor %}</ul>
                <div class="cl"></div>
            </div>

            <div id="rad3">
                <script>
                    rjs3();
                </script>
            </div>
            <div class="side">
                <div class="stit">
                    <h2>猜你喜欢</h2><a href="javascript:getmore({limit:5,mode:2,orderby:'rand'});" class="more">换一换</a>
                    <div class="cl"></div>
                </div>
                <div class="uli2" id="xglike">{% for row in relate_zuixin_list %}
                    <div class="suli">
                        {% if row.litpic %}
                        <a class="limg" href="{{row.id|getArticleDetailUrl}}">
                            <img alt="{{row.title}}" src="/static{{row.litpic}}">
                        </a>
                        {% endif %}
                        <a  href="{{row.id|getArticleDetailUrl}}">{{row.title}}</a>
                        <div class="sulii">
                            {% if row.writer %}
                            <span class="time">{{row.writer}}</span>
                            {% elif row.source %} 
                            <span class="time">{{row.source}}</span>
                            {% endif %} 
                            阅读({{ row.click}})</div>
                        <div class="cl"></div>
                    </div>{% endfor %}</div>
            </div>

            <div id="rad2">
                <script>
                    rjs2();
                </script>
            </div>
        </div><!-- fr_300 end -->
    </div><!-- box end -->
    <script>
         function getmore(condition) {
            var url = "{{'CMS_BASEHOST'|sysconfig}}/api/article/index";
            //var typeid = "";
            $.post(url, condition, function (res) {
                if (res.code == 0) {
                    var json = res.data.list; //数组
                    var str = '';
                    console.log(res.data)
                    $.each(json, function (index) {
                        //循环获取数据
                        //var title = json[index].title;
                        if (condition.mode == 1) {
                            str = str +
                                '<li><a href=" {{getArticleDetailUrl}}' +
                                json[index].id + '">' + json[index].title + '</a></li>';
                        } else if (condition.mode == 2) {
                            var litpic = '';
                            if (json[index].litpic !== '') {
                                litpic =
                                    '<a class="limg" href="{{getArticleDetailUrl}}' +
                                    json[index].id + '"><img alt="' + json[index].title + '" src="/static' +
                                    json[index].litpic + '"></a>';
                            }
                            str = str + '<div class="suli">' + litpic +
                                '<a href="{{getArticleDetailUrl}}' +
                                json[index].id + '">' + json[index].title +
                                '</a><div class="sulii">阅读(' + json[index].click +
                                ')</div><div class="cl"></div></div>';
                        }
                    });

                    if (str != '' && str != null && condition.mode == 1) {
                        $('#xglist').html(str);
                    } else if (str != '' && str != null && condition.mode == 2) {
                        $('#xglike').html(str);
                    }
                } else {

                }
            }, 'json');
        }
        //进行查询
        function query(e,page){
            alert(window.location+'?page='+page)
            window.location.href= '?page='+page
        }

        //这里回调
        $(".pagination").unbind();
        $(".pagination").pagination({
            total_pages:{{ page.total_page }},
            current_page:{{ page.current_page }},
            callback:query
        });
    </script>
    {% include "/index/common/footer.html" %}
</body>

</html>